using System.Collections.Generic;
using System.Threading.Tasks;
using TerritoryGame.Domain.Entities.App;

namespace TerritoryGame.Application.Interfaces
{
    public interface IAppGameStatsService
    {
        Task<PlayerStats> GetPlayerStatsAsync(string playerId);
        Task<RoomStats> GetRoomStatsAsync(string roomId);
        Task<GlobalStats> GetGlobalStatsAsync();
        Task<List<LeaderboardEntry>> GetLeaderboardAsync(int top = 10);
        Task<List<LeaderboardEntry>> GetLeaderboardByCategoryAsync(string category, int top = 10);
        Task UpdatePlayerStatsAsync(string playerId, GameRecord gameRecord);
        Task UpdateRoomStatsAsync(string roomId, GameRecord gameRecord);
        Task<List<PlayerStats>> GetTopPlayersAsync(int top = 10);
    }

    public class RoomStats
    {
        public required string RoomId { get; set; }
        public required string RoomName { get; set; }
        public int TotalGamesPlayed { get; set; }
        public int TotalPlayers { get; set; }
        public double AverageGameDuration { get; set; }
        public DateTime LastGameDate { get; set; }
    }

    public class GlobalStats
    {
        public int TotalGamesPlayed { get; set; }
        public int TotalPlayers { get; set; }
        public int TotalRoomsCreated { get; set; }
        public double AverageGameDuration { get; set; }
        public int TotalAreaPainted { get; set; }
        public DateTime LastGameDate { get; set; }
    }
}
